#!/usr/bin/env bash
set -e
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1
[[ -n $DEBUG ]] && set -x

if [ -n ${sharenum} ]; then
  export REPLICAS=${sharenum};
else
  export REPLICAS=1
fi

if [ -z ${uninstall} ]; then
  envsubst < ./manifests/k8s-device-plugin.yaml | kubectl apply -f -
elif [ -n ${uninstall} ]; then
  kubectl delete -f ./manifests/k8s-device-plugin.yaml
fi
